<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        extends 可以让一个类继承另一个类的所有
        1. 子类的 prototype.__proto__ 指向父类  prototype
        2. 子类复制父类所有的this对象属性
      */
      class Person {
        constructor() {
          this.money = 1000;
          this.admin = true;
        }
        say() {
          console.log("hello !");
        }
      }
      // 复制父类的属性
      class User extends Person {
        // constructor() {
        //   this.money = 1000;
        //   this.admin = true;
        // }
      }
      const u = new User();
      u.say();
      console.log(u.money);
      console.log(u.admin);
    </script>
  </body>
</html>
